package com.example.redis.IO;

import cn.hutool.core.io.IoUtil;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

public class Copy {

    public static void main(String[] args) throws IOException {
        FileInputStream fis=new FileInputStream(new File("D:\\flower.jpg"));
        FileInputStream fis2=new FileInputStream(new File("D:\\flower.jpg"));
        FileOutputStream fos=new FileOutputStream(new File("D:\\flower3.zip"));
        ZipOutputStream gos=new ZipOutputStream(fos);
        gos.putNextEntry(new ZipEntry("flower2.jpg"));
        IoUtil.copy(fis,gos);
        gos.flush();
        gos.putNextEntry(new ZipEntry("flower3.jpg"));
        IoUtil.copy(fis2,gos);
        gos.flush();
        gos.close();
    }
}
